<template>
  <div class="content">
    <div class="button" @click="JumpMessage">
      图形显示
      <!-- <router-link to="/message"></router-link> -->
    </div>
    <div class="button" @click="ueChange">给ue4发送消息</div>
    <div class="button" @click="ueChange2">给ue4发送消息数组</div>
    <div class="button" @click="ueChange3">给ue4发送消息对象</div>
    <div class="button" @click="ueChange4">给ue4发送消息number</div>
    <div class="button" @click="ueChange5">给ue4发送消息混合</div>
    <div>ue4接收消息：{{msg}}</div>
    <div>ue4接收消息2：{{msg2}}</div>
    <div>ue4接收消息3：{{msg3}}</div>
    <div v-for="(item,index) in msg3" :key="index">{{item}}</div>
  </div>
</template>
<script>
export default {
  name: 'Index',
  created() {
    document.title = '首页'
    this.ue4js()
  },
  data() {
    return {
      msg: '', //接收消息
      msg2: null,
      msg3: null
    }
  },
  methods: {
    JumpMessage() {
      this.$router.push('/message')
    },
    ueChange2() {
      let datas = [
        { name: '张三', sex: '男', age: 10 },
        { name: '李三', sex: '女', age: 30 }
      ]
      ue4('sendMessage2', datas)
    },
    ueChange3() {
      let datas = { name: '张三', sex: '男', age: 10 }
      ue4('sendMessage3', { datas })
    },
    ueChange4() {
      let datas = 10
      ue4('sendMessage4', { datas })
    },
    ueChange5() {
      let datas = { name: '张三', sex: '男', age: 10, children: [0, 1, 2, 3] }
      ue4('sendMessage5', { datas })
    },
    ueChange() {
      ue4('sendMessage', '张三12')
    },
    ue4js() {
      ue.interface.openAJDMenu = val => {
        // alert(val)
        this.msg = val
        this.msg2 = JSON.parse(val)
        this.msg3 = JSON.parse(val).string
      }
    }
  }
}
// ue.interface.SetValue=
</script>
<style lang="scss" scoped>
.content {
  padding: 100px;
  .button {
    padding: 10px;
    background: rgb(25, 133, 221);
    color: #fff;
    width: 150px;
    margin-top: 10px;
    cursor: pointer;
  }
  .button2 {
    padding: 10px;
    background: rgb(25, 133, 221);
    color: #fff;
    width: 150px;
  }
}
</style>
